CMAKE_MINIMUM_REQUIRED(VERSION 3.17)

ADD_LIBRARY(LibrariesLevelDB INTERFACE)
ADD_LIBRARY(LIBRARIES::LEVELDB ALIAS LibrariesLevelDB)

IF (CMAKE_SYSTEM MATCHES "Windows")
    TARGET_INCLUDE_DIRECTORIES(LibrariesLevelDB INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/windows/include")
    FIND_LIBRARY(LEVELDB_LIB NAMES leveldb PATHS ${CMAKE_CURRENT_SOURCE_DIR}/windows/lib NO_DEFAULT_PATH)
    TARGET_LINK_LIBRARIES(LibrariesLevelDB INTERFACE
            ${LEVELDB_LIB})
ELSEIF (CMAKE_SYSTEM MATCHES "Android")
    TARGET_INCLUDE_DIRECTORIES(LibrariesLevelDB INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/android_v7_24/include")
    FIND_LIBRARY(LEVELDB_LIB NAMES leveldb PATHS ${CMAKE_CURRENT_SOURCE_DIR}/android_v7_24/lib NO_DEFAULT_PATH)
    TARGET_LINK_LIBRARIES(LibrariesLevelDB INTERFACE
            ${LEVELDB_LIB})
ENDIF ()